package hi.scrap;

import java.awt.AWTException;
import java.awt.Cursor;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Robot;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

class TrackerPanel extends JPanel {
	
	Image defaultCursorImg;
	
	public TrackerPanel() {
		
		defaultCursorImg = new ImageIcon("resources/blacksquare.jpeg").getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
		
//		defaultCursorImg = new ImageIcon("resources/Glowing_Blue_Orb.png").getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT);        
		Point hotspot = new Point(0, 0);     // should be set to the center of your rectangle    
		Cursor cursor = getToolkit().createCustomCursor(defaultCursorImg, hotspot, "cursorname");

		setCursor( cursor );
		
	}
	
    public void paintComponent(Graphics g) {
		
//		Graphics2D g2d = (Graphics2D) g;
//		
//        g.fillOval(10, 10, 10, 10);
    	
    	g.drawImage(defaultCursorImg, 0, 0, null);
    	
    }
    
    public void moveCursorTo(int x, int y) {
    	try {
    	    Robot robot = new Robot();
    	    robot.mouseMove(x, y);
    	} catch (AWTException e) {
    	}
    }
}